# Author:	gong_libin
# Date:		2015_02_07

CC ?= g++
CFLAGS ?= -Wall -O2

GT_ENV ?= /root/GtDns
GT_BIN ?= $(GT_ENV)/bin
GT_INC ?= $(GT_ENV)/inc
GT_SRC ?= $(GT_ENV)/src
GT_OBJ ?= $(GT_ENV)/obj
GT_TST ?= $(GT_ENV)/test

GT_GLIB ?= /usr/lib
GT_GINC ?= /usr/include/GtInc

GT_LIBS =					\
	-L$(GT_GLIB) -lgtglobal			\
	-L$(GT_GLIB) -lpthread

GT_OBJS =					\
	GtDcpDns.o

GT_TGTS =					\
	GtDcpDns

all: $(GT_OBJS) $(GT_TGTS) install

$(GT_OBJS): %.o: %.cpp
	$(CC) -c $(CFLAGS) -I$(GT_INC) -I$(GT_GINC) $< -o $@

$(GT_TGTS):
	$(CC) $(CFLAGS) $(GT_OBJS) -o $(GT_TGTS) $(GT_LIBS)

install:
	cp $(GT_TGTS) $(GT_BIN)
	cp $(GT_OBJS) $(GT_OBJ)

clean:
	rm -rf $(GT_TGTS)
	rm -rf $(GT_OBJS)
